/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package src.report;

import java.io.Serializable;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import javax.servlet.http.HttpSession;
import src.util.Utils;

/**
 *
 * @author Yusup Jauhari Shandi <in.visi>
 */
@ManagedBean
@SessionScoped
public class ReportCfgBean implements Serializable{
    private ReportCfgModel rptCfgHelper;
    private List<SelectItem> availableMonth;
    
    public ReportCfgBean() {
        rptCfgHelper = new ReportCfgModel();
        availableMonth = Utils.getMonths();
    }
    
    public boolean showComponent(Integer menuId,String componentFilter){
        boolean rs;
        
        // FacesContext fc = FacesContext.getCurrentInstance();
        
        String filters = rptCfgHelper.getFiltersById(menuId);
        if (filters!= null)
            rs = (filters.indexOf(componentFilter)>-1);
        else rs = false;
        return rs;
    }

    public List<SelectItem> getAvailableMonth() {
        return availableMonth;
    }
    
    
   
}
